package com.example.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test29 extends AppCompatActivity {
    ListView list;
    List<Map<String,Object>> datalist = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test29);
        list=findViewById(R.id.www);
        for(int i = 0;i<10;i++){
            Map<String, Object> map = new HashMap<>();
            map.put("data","张"+i);
            if (i % 2 == 0){
                map.put("flag",true);
            }else {
                map.put("flag",false);
            }
            datalist.add(map);
        }
        myadapter myadapter = new myadapter(Test29.this, datalist);
        list.setAdapter(myadapter);
    }
}
